package com.kerbores.sigar.gathers;

import org.hyperic.sigar.OperatingSystem;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException;
import org.hyperic.sigar.Who;

/**
 * 操作系统信息收集
 * 
 * @author wkipy
 *
 */
public class OSGather {

	private OperatingSystem operatingSystem = OperatingSystem.getInstance();

	private Who[] whos;

	public OSGather() {
		super();
	}

	public OperatingSystem getOperatingSystem() {
		return operatingSystem;
	}

	public Who[] getWhos() {
		return whos;
	}

	public OSGather(Sigar sigar) {
		init(sigar);
	}

	public static OSGather init(Sigar sigar) {
		OSGather osGather = new OSGather();
		try {
			osGather.whos = sigar.getWhoList();
		} catch (SigarException e) {
			e.printStackTrace();
		}
		return osGather;
	}
}
